{extend name='index/base' /}

{block name='main'}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 图片 <span class="c-gray en">&gt;</span> 首页图片 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
    </div>
    <div class="cl pd-5 bg-1 bk-gray "> <span class="l"><a href="javascript:;" onclick="addarticle('添加','{:url("admin/Sowingmap/addphoto")}','900','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加轮播图</a></span>  </div>
    <div class="mt-20">
        <div class="dataTables_length mb-15" id="DataTables_Table_0_length">
            <!--<label>显示-->
            <!--<select name="DataTables_Table_0_length" id="p" style="width: 50px" aria-controls="DataTables_Table_0" class="select">-->

            <!--</select> 条-->
            <!--</label>-->
        </div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="50">ID</th>
                <th width="100">标题</th>
                <th width="150">图片</th>
                <th width="100">添加时间</th>
                <th width="50">类型</th>
                <th width="150">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name='data' id='v'}
            <tr class="text-c">
                <td><input type="checkbox" value="{$v.id}" name=""></td>
                <td>{$v.id}</td>
                <td>{$v.name}</td>
                <td><img src="/upload/sowingmap/{$v.photo}" alt="" width="150px" height="35px"></td>
                <td>{$v.createtime}</td>
                <td>{$arr[$v.type]}</td>
                {if condition='$v.status==1'}
                    <td> <span class="label label-error radius"><a href="{:url('sowingmap/openAndoffphoto')}?id={$v.id}" style="color:white">关闭</a></span> &nbsp;|&nbsp;
                        <a href="javascript:;" onclick="article_del(this,'{$v.id}')">删除</a></td>
                {else\}
                    <td> <span class="label label-success radius"><a href="{:url('sowingmap/openAndoffphoto')}?id={$v.id}"  style="color:white">开启</a></span>&nbsp;|&nbsp;
                        <a href="javascript:;" onclick="article_del(this,'{$v.id}')">删除</a></td>
                {/if}




            </tr>
            {/volist}
            </tbody>
        </table>
      {$page}
    </div>
</div>
</body>
</html>

{/block}


{block name='my'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<!--<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    $(function(){
//        $('.table-sort').dataTable({
//            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
//            "bStateSave": true,//状态保存
//            "aoColumnDefs": [
//                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
//                {"orderable":false,"aTargets":[]}// 制定列不参与排序
//            ]
//        });

    });
    /*-添加*/
    function addarticle(title,url,w,h){
        layer_show(title,url,w,h);
    }

    function member_show(title,url,id,w,h){
        layer_show(title,url,w,h);
    }


    /*资讯-删除*/
    function article_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{:url("Sowingmap/photodel")}',
                data:{
                    id:id,
                },
                dataType: 'json',
                success: function(data){
                    if(data=='success'){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    /*资讯-编辑*/
    function article_edit(title,url,id,w,h){
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
        });
        layer.full(index);
    }
    $('#p').change(function () {
        var c=$(this).val();
        $('#pc').val(c);
        $('#myform').submit();

    })
    $('#reset').click(function () {
        $('#name').val('');
        $('#myform').submit();
    })

</script>



{/block}